package com.bw.module_message.viewModel

import androidx.lifecycle.viewModelScope
import com.bw.module_message.model.MsgResult
import com.bw.module_message.repo.MsgRepo
import com.bw.lib_common.vm.BaseViewModel
import com.yuwei.http.entity.MessageEntity
import kotlinx.coroutines.launch


class MsgViewModel: BaseViewModel<MessageEntity>() {

    private val msgRepo = MsgRepo()

    fun getMsgList(accessId:String,userId:Int){
        viewModelScope.launch {
            val result = msgRepo.getMsgList(accessId, userId)
            if (result.code == 200){
                mSuccessLiveData.value = result.data
            }else{
                mErrorLiveData.value = result.message
            }
        }
    }
}